# -*- coding: UTF-8 -*-
'''
    公司ocde码枚举以及相关操作类
'''
def enum(**enums):
    return type('Enum', (), enums)

CompanyCodeEnum = enum(
    XC_C_CODE="XC_C_CODE",
    EL_C_CODE="EL_C_CODE",
    TN_C_CODE="TN_C_CODE",
    QNR_C_CODE="QNR_C_CODE",
    TC_C_CODE="TC_C_CODE",
    MT_C_CODE="MT_C_CODE")

# 根据竞品公司简称获得CODE码
def getCompanyCode(competitor):
    # competitor = spiderName.split("_")[0]
    if competitor == "xc":
        CompanyCode = CompanyCodeEnum.XC_C_CODE
    elif competitor == "el":
        CompanyCode = CompanyCodeEnum.EL_C_CODE
    elif competitor == "tn":
        CompanyCode = CompanyCodeEnum.TN_C_CODE
    elif competitor == "qnr":
        CompanyCode = CompanyCodeEnum.QNR_C_CODE
    elif competitor == "tc":
        CompanyCode = CompanyCodeEnum.TC_C_CODE
    elif competitor == "mt":
        CompanyCode = CompanyCodeEnum.MT_C_CODE
    else:
        CompanyCode = ""
    return CompanyCode